package cn.initcap.concurrency.classloader;

/**
 * 测试java是值传递还是引用传递
 * <p>
 * https://www.cnblogs.com/hpyg/p/8005599.html
 *
 * @author initcap
 * @date Created in 7/5/19 5:59 PM.
 */
public class ReferenceOrValue {

    public static void main(String[] args) {

        StringBuffer sb = new StringBuffer("Hello ");

        System.out.println("Before change, sb = " + sb);

        changeData(sb);

        System.out.println("After changeData(n), sb = " + sb);

    }

    public static void changeData(StringBuffer strBuf) {

        strBuf = new StringBuffer("Hi ");

        strBuf.append("World!");

    }

}
